PHP: Does $_SERVER['HTTP_X_REQUESTED_WITH'] exist or not?

Posted by Hank on Stack Overflow See other posts from Stack Overflow or by Hank
Published on 2010-04-05T15:38:39Z Indexed on 2010/04/05 15:43 UTC
Read the original article Hit count: 424

Filed under:
|
|

All over the Internet, included even here at StackOverlow, people state that a good way to check if a request is AJAX or not is to do the following:

strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )

However, I don't see $_SERVER['HTTP_X_REQUESTED_WITH'] in the official PHP documentation

And when I try to do the following:

echo $_SERVER['HTTP_X_REQUESTED_WITH'];

Nothing is outputted.

Am I doing something wrong? Because I'd really like to be able to use $_SERVER['HTTP_X_REQUESTED_WITH'] if it's available.

© Stack Overflow or respective owner

Related posts about php

Related posts about web-development